Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization Issues in JSON Responses #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vaibhavgeek
Copy link

@vaibhavgeek vaibhavgeek commented Oct 29, 2024

Fix BigInt Serialization Issues in JSON Responses

Problem

The original implementation was encountering serialization errors when attempting to return responses containing BigInt values. This occurred because BigInt values cannot be directly serialized to JSON.

Changes Made

  1. Added explicit string conversion for BigInt fields in the response objects:

    • paymasterVerificationGasLimit
    • paymasterPostOpGasLimit
  2. Created a serializedResult object that converts BigInt values to strings before JSON serialization:

const serializedResult = {
    ...result,
    paymasterVerificationGasLimit: result.paymasterVerificationGasLimit?.toString(),
    paymasterPostOpGasLimit: result.paymasterPostOpGasLimit?.toString()
};

Testing

Verified that API responses now successfully serialize without errors
Confirmed compatibility with both EntryPoint versions
Added console.log statements to help with debugging response data

Impact

This change ensures proper handling of BigInt values in the paymaster API responses while maintaining the expected response format for clients. The modification is backward compatible and improves the reliability of the service.
Please review and merge these changes to resolve the serialization issues.

@vaibhavgeek vaibhavgeek changed the title Update app.ts - searlisation errors fixed Serialization Issues in JSON Responses Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants